Use strtoull to parse the final_exec_addr value from the command
line. Whe cross compiling on i386 for x86-64 unsigned long is 32 bit,
which leads to final_exec_addr being truncated to 32 bits by strtoul,
which leads to grub refusing to load the resulting image. Please
apply.
Use the target nm(1) when cross compiling to pick the _end address
from the Xen binary.
Signed-Off-By: Muli Ben-Yehuda <mulix@mulix.org>
$(TARGET): $(TARGET)-syms boot/mkelf32
./boot/mkelf32 $(TARGET)-syms $(TARGET) 0x100000 \
- `nm $(TARGET)-syms | sort | tail -n 1 | sed -e 's/^\([^ ]*\).*/0x\1/'`
+ `$(NM) $(TARGET)-syms | sort | tail -n 1 | sed -e 's/^\([^ ]*\).*/0x\1/'`
$(CURDIR)/arch.o: $(OBJS)
$(LD) $(LDFLAGS) -r -o $@ $(OBJS)
inimage = argv[1];
outimage = argv[2];
- loadbase = strtoul(argv[3], NULL, 16);
+ loadbase = strtoull(argv[3], NULL, 16);
final_exec_addr = strtoul(argv[4], NULL, 16);
infd = open(inimage, O_RDONLY);